<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="/static/jquery-1.11.3.js"></script>

    <script>
        $(function () {

            $('#login').click(function () {


                var $usernameInput = $('#username');
                var $passwordInput = $('#password');

                var u = $usernameInput.val();
                var p = $passwordInput.val();

                var param = {username: u, password: p};
                $.post('/loginJson', param, function (data) {
                    if (data.success) {
                        //登陆成功
                        location.href = 'http://localhost:8090/employee/list';
                    } else {
                        //登陆失败
                        $('#result').html(data.msg).css('color', 'red');
                    }
                });
            });
        });
    </script>

</head>
<body>

<h1>Post 模拟登录</h1>
<span id="result"></span>
用户名：<input type="text" name="username" id="username"><br>
密码： <input type="text" name="password" id="password"><br>
<button id="login">登录</button>
</body>
</html>